﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.IO;
using System.Drawing;
using System.Windows.Forms;

namespace DiPlaner
{
    public class Profile
    {
        public string Path { get; set; }
        public int ScheduleSet { get; set; }
        public List<BotProfile> Bots { get; set; }
        public BotSchedule WorkPlan { get; set; }

        public struct BotSchedule
        {
            public List<BotStart> Schedule;
            public TimeSpan Delay;
            public TimeSpan workTime;
        }

        public struct BotProfile
        {
            public int slot;

            public string d3_path;
            public string bnet;
            public string pass;

            public string db_path;
            public string db_key;
            public string db_routine;

            public Size size;
            public Point pos;

            public bool ready;
            public BotStatus status;
        }

        public struct BotStart
        {
            public DateTime startTime;
            public DateTime stopTime;
            public DateTime flagtime;
            public DateTime pauseflag;
            public BotStatus status;
        }

        public enum BotStatus
        {
            stop,
            _stoping,

            paused,
            _pausing,
            _resuming,

            running,
            _starting,

            idle,
            crashed
        }

        public Profile Initialize()
        {
            Profile _prof = new Profile();
            _prof.Bots = new List<BotProfile>(8);
            for (int i = 0; i < 8; i++)
            {
                Profile.BotProfile bp = new BotProfile()
                {
                    slot = i
                };
                _prof.Bots.Add(bp);
            }
            return _prof;
        }
    }
}
